package com.changgou.goods.dao;

import com.changgou.goods.pojo.Sku;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.special.InsertListMapper;
import tk.mybatis.mapper.provider.SpecialProvider;

import java.util.List;

public interface SkuMapper extends Mapper<Sku>,InsertListMapper<Sku> {
    /**
     * 批量插入
     * @param skuList
     *
     */
    @Insert("<script>insert into tb_sku (id,price,num,alert_num,image,category_id,category_name,brand_name,spu_id,spec) " +
            "values <foreach collection='skuList' item='item' separator=','>" +
            "(#{item.id},#{item.price},#{item.num},#{item.alertNum},#{item.image},#{item.categoryId},#{item.categoryName},#{item.brandName},#{item.spuId},#{item.spec})" +
            "</foreach></script>")
    void batchInsert(@Param("skuList") List skuList);



}
